package cn.readjava.bean;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import java.io.Serializable;
import java.util.Objects;

@Entity
public class Article implements Serializable {
    private long articleId;
    private Long articleTypeId;
    private String articleTitle;
    private String articleIcon;
    private String articleIntroduce;
    private String articleContent;
    private Integer articleState;

    @Id
    @Column(name = "article_id", nullable = false)
    public long getArticleId() {
        return articleId;
    }

    public void setArticleId(long articleId) {
        this.articleId = articleId;
    }

    @Basic
    @Column(name = "article_type_id", nullable = true)
    public Long getArticleTypeId() {
        return articleTypeId;
    }

    public void setArticleTypeId(Long articleTypeId) {
        this.articleTypeId = articleTypeId;
    }

    @Basic
    @Column(name = "article_title", nullable = true, length = 255)
    public String getArticleTitle() {
        return articleTitle;
    }

    public void setArticleTitle(String articleTitle) {
        this.articleTitle = articleTitle;
    }

    @Basic
    @Column(name = "article_icon", nullable = true, length = 255)
    public String getArticleIcon() {
        return articleIcon;
    }

    public void setArticleIcon(String articleIcon) {
        this.articleIcon = articleIcon;
    }

    @Basic
    @Column(name = "article_introduce", nullable = true, length = 255)
    public String getArticleIntroduce() {
        return articleIntroduce;
    }

    public void setArticleIntroduce(String articleIntroduce) {
        this.articleIntroduce = articleIntroduce;
    }

    @Basic
    @Column(name = "article_content", nullable = true, length = -1)
    public String getArticleContent() {
        return articleContent;
    }

    public void setArticleContent(String articleContent) {
        this.articleContent = articleContent;
    }

    @Basic
    @Column(name = "article_state", nullable = true)
    public Integer getArticleState() {
        return articleState;
    }

    public void setArticleState(Integer articleState) {
        this.articleState = articleState;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Article article = (Article) o;
        return articleId == article.articleId &&
                Objects.equals(articleTypeId, article.articleTypeId) &&
                Objects.equals(articleTitle, article.articleTitle) &&
                Objects.equals(articleIcon, article.articleIcon) &&
                Objects.equals(articleIntroduce, article.articleIntroduce) &&
                Objects.equals(articleContent, article.articleContent) &&
                Objects.equals(articleState, article.articleState);
    }

    @Override
    public int hashCode() {

        return Objects.hash(articleId, articleTypeId, articleTitle, articleIcon, articleIntroduce, articleContent, articleState);
    }
}
